import types

class Proto():
    def __init__(self, _name):
        self._name = _name
    def proto_mothod(self):
        raise NotImplemented
    def proto_print(self):
        print("Proto_")
    
#main

proto = Proto("Proto_name")
proto.proto_print() #Proto_

def new_proto_mothod(self):print(self._name)

proto.proto_mothod = types.MethodType(new_proto_mothod, proto)

proto.proto_mothod() #Proto_name

proto.other_name = "Proto_other_name"

def new_other_proto_mothod(self):print(self.other_name)
    
proto.proto_mothod = types.MethodType(new_other_proto_mothod, proto)
proto.proto_mothod() #Proto_other_name

class A:
    pass

proto2 = A()
proto2.proto_mothod = types.MethodType(new_proto_mothod, proto2)
setattr(proto2,'_name',"object_name")
proto2.proto_mothod()

def methodtest(self):
    print "class prototypes instances"

A.metho_test = types.MethodType(methodtest, A)

a_instance = A()
a_instance.metho_test()


proto2.metho_test()




